package com.example.dirviesystem.config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
public class ExceptionControl {
    // 处理所有未捕获的异常
    @ExceptionHandler(Exception.class)
    public R<String> handleException(Exception e) {
        // 可根据需要记录日志
        return R.own(500, e.getMessage(), e.getLocalizedMessage());
    }
}
